import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Demo3 {
    public static void main(String[] args) {
        ExecutorService service = Executors.newFixedThreadPool(4);
        //Executors.newCachedThreadPool();
        for (int i = 0; i < 1000; i++) {
            int id=i;
            service.submit(()->{
                System.out.println("hello "+ id +Thread.currentThread().getName());
            });
        }
    }
}
